package com.whfc.cncit.helmet.codec;

import com.whfc.cncit.constant.CncitConst;
import com.whfc.cncit.entity.CncitUpMsgPSA;
import com.whfc.cncit.entity.CncitUpMsgR;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @Description:
 * @author: xugcheng
 * @version: 1.0
 * @date: 2019/10/25 15:13
 */
public class CncitUpMsgCodecPSA implements CncitMsgCodec<CncitUpMsgPSA> {

    private final Logger logger = LoggerFactory.getLogger(this.getClass());


    @Override
    public CncitUpMsgPSA decode(String data) {
        logger.info("data:{}", data);
        //$0F,PSA,0001,TTSD,#
        CncitUpMsgPSA msg = null;
        String[] dataArr = data.split(CncitConst.DELIMITER);
        if (dataArr.length >= 4) {
            String deviceId = dataArr[2];
            String type = dataArr[3];
            msg = new CncitUpMsgPSA(deviceId, type);
        }
        return msg;
    }

    @Override
    public String encode(CncitUpMsgPSA msg) {
        return null;
    }
}
